package com.qmds.common.core.utils;

/**
 * --- 代码敲烂 月薪过万 ---
 *
 * @author ShiJiaWei
 * @date 2024/8/20
 * @desc:
 */
public class UserUtils {
    private static final ThreadLocal<Integer> threadLocal = new ThreadLocal<>();

    /**
     * 存储当前登录用户的id
     * @param uid
     */
    public static void setId(Integer uid) {
        threadLocal.set(uid);
    }

    /**
     * 获取当前登录用户的id
     * @return
     */
    public static Integer getId() {
        return threadLocal.get();
    }

    /**
     * 移除当前登录用户的id
     */
    public static void removeId() {
        threadLocal.remove();
    }
}
